import React, { useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import "../../../api/list"
import axios from '../../../until/axios'
import { SETLIST, ALLSTATETYPE } from "../../../type/store.d"
import { Tabs } from 'react-vant';

function Shou() {
  const dispatch = useDispatch()
  useEffect(() => {
    axios.get("/api/list").then(res => {
      dispatch({
        type: SETLIST,
        payload: res.data.list
      })
    })
  }, [])
  const list = useSelector((state: ALLSTATETYPE) => {
    return state.list
  })
  return (
    <div>
      <Tabs active={0}>
        <Tabs.TabPane title="标签">
          {
            list && list.map((item, index) => {
              return <p key={index}>{item.title}</p>
            })
          }
        </Tabs.TabPane>

      </Tabs>
    </div>
  )

}

export default Shou